<template>
  <div class="home">
    <h1 style="color:red;">{{this.txt}}</h1>
    <h5>{{this.count}}</h5>
    <input type="button" value="调用了add" @click="add" />
    <input type="button" value="调用了mutations并传递参数" @click="addMut" />
  </div>
</template>
<script>
import {mapState,mapMutations,mapActions,mapGetters} from "vuex"
export default {
  name: "Home",
  computed: {
      ...mapState(["txt","count"])
  },
  methods:{
    ...mapMutations(["addN","addMutations"]),
    ...mapActions(["addAsync"]),
    
    add(){
      this.addN();
    },
    addMut(){
      this.addMutations({
        name: "cz",
        age: 123
      });
    }
  } 
}
</script>
